import requests
import datetime
def query():
	r=requests.get("http://localhost:8000/users")
	print(r.json())
def create():
	query()
	n=datetime.datetime.now()
	create=n.strftime("%Y-%m-%dT%H:%M:%SZ00:00")
	update=create
	r=requests.post("http://localhost:8000/users",
		json={"updatedat":update, "createdat":create,"name":"nm","email":"e1"})
	print(r.json())
	query()
def update():
	r=requests.get("http://localhost:8000/users")
	users=r.json()
	one=users[0]
	r=requests.put("http://localhost:8000/users/"+str(one["id"]),json={"name":"newname"})
	query()
def delete():
	query()
	r=requests.get("http://localhost:8000/users")
	users=r.json()
	one=users[0]
	r=requests.delete("http://localhost:8000/users/"+str(one["id"]))
	query()

# post()
# get()
# update()
create()
# delete()